home *** CD-ROM | disk | FTP | other *** search
- Path: soap.news.pipex.net!pipex!usenet
- From: chris.neale@ooh.conqueror.co.uk (Chris Neale)
- Newsgroups: comp.lang.c++
- Subject: A beginners valiant effort.
- Date: Mon, 19 Feb 1996 04:19:09 GMT
- Organization: The Extremeties Ltd.
- Message-ID: <4g81kr$mrs@soap.news.pipex.net>
- Reply-To: chris.neale@ooh.conqueror.co.uk
- NNTP-Posting-Host: ak161.du.pipex.com
- X-Newsreader: Forte Free Agent 1.0.82
-
- Please, Please! Help! Why doesn't this work - the book says it should,
- but the IF statement falls through - like a switch statement. Try it
- and see.
-
- Thanks, Chris
-
- please e-mail responses to neales@dial.pipex.com - Ta.
-
-
- #include <iostream.h>
- #include <string.h>
-
- enum boolean{false, true};
-
- class switc_string
- {
- private:
- char string_val_one[16];
- char string_val_two[12];
- public:
- void set_string(char string1[], char string2[])
- {
- strcpy(string_val_one, string1);
- strcpy(string_val_two, string2);
- }
- void get_string(boolean string_index)
- {
- cout << string_index;
- if ( string_index )
- {cout << string_val_one;}
-
- else
- {cout << string_val_two;}
- }
- };
-
- void main()
-
- {
-
- switc_string s1;
- s1.set_string("is not flowering","is flowering");
- cout << endl;
- s1.get_string(1);
-
- }
-
-
-